Returns the last element of a parallel sequence that satisfies a specified condition.
Namespace:
System.Linq
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Shared Function Last(Of TSource) ( _
source As ParallelQuery(Of TSource), _
predicate As Func(Of TSource, Boolean) _
) As TSource |
C# |
---|
public static TSource Last<TSource>(
ParallelQuery<TSource> source,
Func<TSource, bool> predicate
)
|
Parameters
- source
- Type: System.Linq..::.ParallelQuery<(Of <(TSource>)>)
The sequence to return an element from.
- predicate
- Type: System..::.Func<(Of <(TSource, Boolean>)>)
A function to test each element for a condition.
Type Parameters
- TSource
- The type of the elements of source.
Return Value
The last element in the sequence that passes the test in the specified predicate function.
Exceptions
Exception | Condition |
---|
System..::.ArgumentNullException |
source or predicate is a null reference (Nothing in Visual Basic).
|
System..::.InvalidOperationException |
No element in source satisfies the condition in predicate.
|
System..::.AggregateException |
One or more exceptions occurred during the evaluation of the query.
|
System..::.OperationCanceledException |
The query was canceled.
|
See Also